package com.android.settings.ios.wallpaper;

import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.android.settings.ios.R;

public class WallpaperPreviewLayout extends LinearLayout {

    private ImageView mImgLock;
    private ImageView mImgHome;

    public WallpaperPreviewLayout(Context context) {
        super(context);
    }

    public WallpaperPreviewLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public WallpaperPreviewLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();

        mImgLock = findViewById(R.id.img_lock);
        mImgHome = findViewById(R.id.img_home);

        WallpaperManager wm = getContext().getSystemService(WallpaperManager.class);

        Bitmap lock = null;//wm.getBitmap(false, WallpaperManager.FLAG_LOCK);
        Bitmap home = null;//wm.getBitmap(false, WallpaperManager.FLAG_SYSTEM);

        if (lock != null) {
            mImgLock.setImageBitmap(lock);
        } else if (home != null) {
            mImgLock.setImageBitmap(home);
        }

        if (home != null) {
            mImgHome.setImageBitmap(home);
        } else if (lock != null) {
            mImgHome.setImageBitmap(lock);
        }
    }
}
